﻿function whoisspamming_OnLoad()
	DEFAULT_CHAT_FRAME:AddMessage("whoisspaming: /ws for toggle");
	this:RegisterEvent("MINIMAP_PING");
	this:RegisterEvent("PLAYER_ENTERING_WORLD");
	SLASH_WSSPAM1 = "/ws";
        SlashCmdList["WSSPAM"] = function(msg)
		FaraFrames_SlashCommandHandler(msg);
	end

end

function whoisspamming_OnEvent()
	if (event == "MINIMAP_PING") then
		map_name:AddMessage(UnitName(arg1),1,.5,.5);
		map_add:AddMessage(LEVEL..UnitLevel(arg1).." "..UnitClass(arg1),1,1,1);
	end
	if (event == "PLAYER_ENTERING_WORLD") then
		map_name:SetFont("Fonts\\ZYKai_C.TTF",18,"OUTLINE");
		map_name:SetHeight(20);
		map_name:SetTimeVisible(.1)
		map_add:SetFont("Fonts\\ZYKai_C.TTF",16,"OUTLINE");
		map_add:SetHeight(18);
		map_add:SetTimeVisible(.1)
	end
end

function FaraFrames_SlashCommandHandler(msg)
    local frame = getglobal("where_frame")
    if (msg == "info") then
      --DEFAULT_CHAT_FRAME:AddMessage("WhoIsSpamming 汉化 by ondh @ 二区·毁灭之锤")
    end

    if (frame) then
    if(  frame:IsVisible() ) then
       frame:Hide();
    else
       frame:Show();
    end
    end
end
